﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Server.Utils
{
    class StringUtils
    {
        #region[获取当前时间]
        public static string GetDateStr()
        {
            return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        }
        #endregion

        #region[拆分指定位置的数据]

        /// <summary>
        /// 拆分指定位置的数据
        /// </summary>
        /// <param name="msg">源数据</param>
        /// <param name="pos">位置</param>
        /// <param name="c">拆分依据</param>
        /// <returns>取出的结果</returns>
        public static string AfxExtractSubString(string msg, int pos, char c)
        {
            string[] flags = msg.Split(c);
            if (flags.Length > pos)
                return flags[pos];
            return String.Empty;
        }

        #endregion
    }
}
